﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMLGener.Interfaces;
using XMLGener.Data;
namespace XBasicModules
{
    /// <summary>
    /// This module generate simple only one string.
    /// </summary>
    public class SimpleString:ModuleBase,XMLGenerModuleInterface
    {
        #region XMLGenerModuleInterface Members

        private string text = "";

        /// <summary>
        /// Return user defined string.
        /// </summary>
        /// <returns></returns>
        public string generate()
        {
            return text;
        }

        /// <summary>
        /// return this module definition
        /// </summary>
        /// <returns>definition</returns>
        public string getDefinition()
        {
            return    
              "<function>"+
              "    <name>Simple String</name>"+
              "    <id>simpleString</id>"+
              "    <type>string</type>"+
              "    <attributes>"+
              "       <attribute>"+
              "          <name>Text</name>"+
              "          <id>text</id>"+
              "          <type>text</type>"+
              "       </attribute>"+
              "    </attributes>" +
              "</function>";

        }

        /// <summary>
        /// set attributes to this module
        /// </summary>
        /// <param name="xmlParams"></param>
        /// <param name="parentDocument"></param>
        public void setParameters(string xmlParams, XMLGenerDocument parentDocument)
        {
            if (!this.checkSettingsElement(xmlParams, parentDocument))
                return;
            this.text = this.getParam("text");
            
        }

        #endregion
    }
}
